apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: tdengine
name: tdengine
namespace: default
spec:
podManagementPolicy: OrderedReady
replicas: 3
selector:
matchLabels:
app: tdengine
serviceName: tdengine
template:
metadata:
labels:
app: tdengine
name: tdengine
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- node1
- node2
- node3
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- tdengine
topologyKey: kubernetes.io/hostname
weight: 1
containers:
- env:
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: firstEp
value: tdengine-0.tdengine.default.svc.cluster.local:6030
- name: fqdn
value: $(POD_NAME).tdengine.default.svc.cluster.local
image: tdengine/tdengine:2.0.1.1
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- taos
- -s
- show dnodes
failureThreshold: 3
initialDelaySeconds: 300
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
name: tdengine
ports:
- containerPort: 6030
name: tcp6030
protocol: TCP
- containerPort: 6035
name: tcp6035
protocol: TCP
- containerPort: 6041
name: tcp6041
protocol: TCP
- containerPort: 6030
name: udp6030
protocol: UDP
- containerPort: 6031
name: udp6031
protocol: UDP
- containerPort: 6032
name: udp6032
protocol: UDP
- containerPort: 6033
name: udp6033
protocol: UDP
- containerPort: 6034
name: udp6034
protocol: UDP
- containerPort: 6035
name: udp6035
protocol: UDP
- containerPort: 6036
name: udp6036
protocol: UDP
- containerPort: 6037
name: udp6037
protocol: UDP
- containerPort: 6038
name: udp6038
protocol: UDP
- containerPort: 6039
name: udp6039
protocol: UDP
- containerPort: 6040
name: udp6040
protocol: UDP
command: ["/bin/sh"]
args: ["-c", "echo fqdn $fqdn > /etc/taos/taos.cfg;echo firstEp $firstEp >> /etc/taos/taos.cfg;taosd"]
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/lib/taos
name: datadir
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoSchedule
key: type
operator: Equal
value: basic
updateStrategy:
type: RollingUpdate
volumeClaimTemplates:
- metadata:
name: datadir
annotations:
volume.beta.kubernetes.io/storage-class: "managed-nfs-storage"
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
volumeMode: Filesystem
---
apiVersion: v1
kind: Service
metadata:
name: tdengine
spec:
clusterIP: None
ports:
- name: tcp6030
port: 6030
protocol: TCP
targetPort: 6030
- name: tcp6035
port: 6035
protocol: TCP
targetPort: 6035
- name: tcp6041
port: 6041
protocol: TCP
targetPort: 6041
- name: udp6030
port: 6030
protocol: UDP
targetPort: 6030
- name: udp6031
port: 6031
protocol: UDP
targetPort: 6031
- name: udp6032
port: 6032
protocol: UDP
targetPort: 6032
- name: udp6033
port: 6033
protocol: UDP
targetPort: 6033
- name: udp6034
port: 6034
protocol: UDP
targetPort: 6034
- name: udp6035
port: 6035
protocol: UDP
targetPort: 6035
- name: udp6036
port: 6036
protocol: UDP
targetPort: 6036
- name: udp6037
port: 6037
protocol: UDP
targetPort: 6037
- name: udp6038
port: 6038
protocol: UDP
targetPort: 6038
- name: udp6039
port: 6039
protocol: UDP
targetPort: 6039
- name: udp6040
port: 6040
protocol: UDP
targetPort: 6040
selector:
app: tdengine
sessionAffinity: None
type: ClusterIP